package com.my.goodsmanage.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author 徐佳辉
 * @date 2020/9/25 23:11
 */
@Configuration
public class SpringMvcConfigurationInitializer extends WebMvcConfigurerAdapter {

    @Value("${picture.url}")
    private String url;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {


        registry.addResourceHandler("/imgs/**").addResourceLocations("file:" + url);

        super.addResourceHandlers(registry);
    }
}
